<template>
  <!-- 上传模态框 -->
  <div v-if="visible" class="modal-overlay" @click="closeUploadModal">
    <div class="upload-modal" @click.stop>
      <div class="modal-header">
        <h3 class="modal-title">{{ isEditMode ? '编辑3D模型' : '上传3D模型' }}</h3>
        <button class="close-btn" @click="closeUploadModal">&times;</button>
      </div>
      
      <div class="modal-body">
        <!-- 产品信息表单 -->
        <div class="product-form">
          <!-- 产品名称 -->
          <div class="form-group">
            <label class="form-label">产品名称</label>
            <input 
              type="text" 
              v-model="uploadForm.productName"
              placeholder="请输入产品名称"
              class="form-input"
              maxlength="50"
            >
          </div>

          <!-- 分类选择 -->
          <div class="form-group">
            <label class="form-label">产品分类</label>
            <select v-model="uploadForm.category" class="form-select">
              <option value="">请选择分类</option>
              <option v-for="category in props.categories" :key="category" :value="category">
                {{ category }}
              </option>
            </select>
          </div>

          <!-- 是否压缩 -->
          <div v-if="!isEditMode" class="form-group">
            <label class="form-label">是否压缩文件</label>
            <div style="display:flex; align-items:center; gap:8px;">
              <input type="checkbox" id="ifDracoCheckbox" v-model="uploadForm.ifDraco" />
              <label for="ifDracoCheckbox" style="font-size:13px; color:#666;">勾选则启用 Draco 压缩（默认勾选）</label>
            </div>
          </div>

          <!-- 产品描述 -->
          <div class="form-group">
            <label class="form-label">产品描述</label>
            <textarea 
              v-model="uploadForm.description"
              placeholder="请描述您的3D模型特点、用途等信息（选填）"
              class="form-textarea"
              rows="3"
              maxlength="200"
            ></textarea>
          </div>

          <!-- 封面图片 -->
          <div v-if="!isEditMode" class="form-group">
            <label class="form-label">封面图片</label>
            <input 
              type="file" 
              :id="coverInputId" 
              accept="image/*"
              @change="handleCoverUpload"
              style="display: none"
            >
            <div class="cover-upload">
              <label :for="coverInputId" class="cover-zone">
                <div v-if="!hasCoverImage" class="cover-placeholder">
                  <img src="@/assets/upload.svg" alt="上传" class="upload-icon" />
                  <p>点击上传封面</p>
                </div>
                <img v-else :src="surfacePlotUrl" alt="封面预览" class="cover-preview" />
              </label>
            </div>
          </div>
          
          <!-- 编辑模式下的封面图片显示 -->
          <div v-if="isEditMode" class="form-group">
            <label class="form-label">封面图片</label>
            <div class="cover-readonly-section">
              <div v-if="props.editModel?.surfacePlot" class="current-cover readonly">
                <img :src="props.editModel.surfacePlot" alt="当前封面" class="cover-preview" />
                <div class="cover-overlay readonly">
                  <span class="readonly-text">封面图片（编辑模式下不可修改）</span>
                </div>
              </div>
              <div v-else class="no-cover">
                <p class="no-cover-text">暂无封面图片</p>
                <p class="no-cover-note">（编辑模式下不可添加封面）</p>
              </div>
            </div>
          </div>
        </div>

        <!-- 文件上传区域 -->
        <div v-if="!isEditMode" class="upload-area">
          <div class="upload-zone" :class="{ 'has-file': uploadedFile }">
            <input 
              type="file" 
              :id="fileInputId"
              accept=".glb,.gltf,.zip" 
              @change="handleFileUpload"
              style="display: none"
            >
            <label :for="fileInputId" class="upload-label">
              <div class="upload-text">
                <p v-if="!uploadedFile" class="upload-primary">点击选择或拖拽文件到此处</p>
                <p v-else-if="isUploading" class="upload-primary">正在上传: {{ uploadedFile?.name }}</p>
                <p v-else class="upload-primary">已选择: {{ uploadedFile?.name }}</p>
                <p class="upload-secondary">支持 GLB、GLTF格式，最大100MB</p>
              </div>
            </label>
          </div>
        </div>
        
        <!-- 编辑模式下的文件信息显示 -->
        <div v-if="isEditMode && props.editModel?.fileUrl" class="current-file-info">
          <div class="current-file-card">
            <div class="file-icon">📁</div>
            <div class="file-details">
              <div class="file-name">{{ getFileNameFromUrl(props.editModel.fileUrl) }}</div>
              <div class="file-url">{{ props.editModel.fileUrl }}</div>
            </div>
            <div class="file-actions">
              <button class="btn-download" @click="downloadFile" title="下载文件">
                下载
              </button>
            </div>
          </div>
          <div class="file-info-note">
            <span>文件信息（编辑模式下不可修改）</span>
          </div>
        </div>

      </div>

      <div class="modal-footer">
        <button 
          v-if="uploadedFile || isEditMode" 
          @click="startUpload"
          class="btn-primary"
          :disabled="isUploading"
        >
          <span v-if="isUploading" class="uploading-state">
            <span class="loading-spinner"></span>
            {{ isEditMode ? '保存中...' : '上传中...' }}
          </span>
          <span v-else>{{ isEditMode ? '保存修改' : '确认上传' }}</span>
        </button>
        <button 
          @click="closeUploadModal" 
          class="btn-cancel"
          :disabled="isUploading"
        >
          {{ isUploading ? '最小化' : '关闭' }}
        </button>
      </div>
    </div>
  </div>
  
  <!-- ZIP预览模态框 -->
  <ZipPreviewModal
    :visible="showZipPreviewModal"
    :parse-result="zipParseResult"
    :zip-file-name="zipFileName"
    :is-uploading="isUploading"
    :categories="props.categories"
    @close="closeZipPreviewModal"
    @confirm="handleZipConfirm"
  />
</template>

<script setup>
import { ref, computed, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { uploadAndProcessFile, alterModelData } from '@/api/model'
import { getUserInfo } from '@/utils/auth'
import AESencrypt from '@/utils/AESencrypt'
import ZipPreviewModal from './ZipPreviewModal.vue'
import { parseZipFile } from '@/utils/zipParser'

// Props定义
const props = defineProps({
  visible: {
    type: Boolean,
    required: true
  },
  editModel: {
    type: Object,
    default: null
  },
  // 分类列表，从父组件传入
  categories: {
    type: Array,
    default: () => [
      '建筑模型',
      '家具模型',
      '交通工具',
      '角色模型',
      '衣物模型',
      '自然景观',
      '电子产品',
      '其他'
    ]
  }
})

const emit = defineEmits(['close', 'uploadSuccess', 'editSuccess'])

// 生成唯一ID避免冲突
const componentId = Math.random().toString(36).substring(2, 9)
const coverInputId = `cover-input-${componentId}`
const fileInputId = `file-input-${componentId}`

// 文件数据
const uploadedFile = ref(null)
const isUploading = ref(false)
const showZipPreviewModal = ref(false)
const zipParseResult = ref({
  success: false,
  modelFiles: [],
  totalFiles: 0,
  modelFileCount: 0,
  otherFileCount: 0
})
const zipFileName = ref('')

// 上传表单数据
const uploadForm = ref({
  productName: '',
  category: '',
  description: '',
  surfacePlot: null,
  ifDraco: true,
  compressionLevel: null
})

// 计算属性
const isEditMode = computed(() => !!props.editModel)

// 是否有封面图片
const hasCoverImage = computed(() => {
  return uploadForm.value.surfacePlot || (isEditMode.value && props.editModel?.surfacePlot)
})

// 生成封面预览URL
const surfacePlotUrl = computed(() => {
  if (uploadForm.value.surfacePlot) {
    return URL.createObjectURL(uploadForm.value.surfacePlot)
  }
  if (isEditMode.value && props.editModel?.surfacePlot) {
    return props.editModel.surfacePlot
  }
  return ''
})

// 监听编辑模式变化，初始化表单数据
watch(() => props.editModel, (newModel) => {
  if (newModel && isEditMode.value) {
    uploadForm.value = {
      productName: newModel.productName || '',
      category: newModel.category || '',
      description: newModel.description || '',
      surfacePlot: null
    }
  }
}, { immediate: true })

const closeUploadModal = () => {
  emit('close')
  resetUploadState()
}

const handleCoverUpload = (event) => {
  const target = event.target
  const file = target.files?.[0]
  if (!file) return
  uploadForm.value.surfacePlot = file
}

const getFileNameFromUrl = (url) => {
  try {
    const urlObj = new URL(url)
    const pathname = urlObj.pathname
    const fileName = pathname.split('/').pop() || '未知文件'
    return fileName
  } catch {
    return '未知文件'
  }
}

const downloadFile = () => {
  if (!props.editModel?.fileUrl) {
    ElMessage.warning('无法下载：文件URL无效')
    return
  }
  
  try {
    const link = document.createElement('a')
    link.href = props.editModel.fileUrl
    link.download = getFileNameFromUrl(props.editModel.fileUrl)
    link.target = '_blank'
    document.body.appendChild(link)
    link.click()
    document.body.removeChild(link)
    ElMessage.success('开始下载文件')
  } catch (error) {
    console.error('下载失败:', error)
    ElMessage.error('下载失败，请检查文件链接')
  }
}

const resetUploadState = () => {
  uploadedFile.value = null
  isUploading.value = false
  uploadForm.value = {
    productName: '',
    category: '',
    description: '',
    surfacePlot: null
  }
  zipParseResult.value = {
    success: false,
    modelFiles: [],
    totalFiles: 0,
    modelFileCount: 0,
    otherFileCount: 0
  }
  zipFileName.value = ''
  const input = document.getElementById(fileInputId)
  if (input) input.value = ''
  const coverInput = document.getElementById(coverInputId)
  if (coverInput) coverInput.value = ''
}

const closeZipPreviewModal = () => {
  showZipPreviewModal.value = false
}

const handleZipConfirm = async (selectedFiles) => {
  if (selectedFiles.length === 0) {
    ElMessage.warning('请至少选择一个文件进行上传')
    return
  }
  
  isUploading.value = true
  
  try {
    ElMessage.info(`开始上传 ${selectedFiles.length} 个文件...`)
    const userInfo = getUserInfo()
    const user = userInfo?.user || userInfo?.username || userInfo?.phone || ''
    
    let successCount = 0
    let failCount = 0
    
    for (const modelFile of selectedFiles) {
      try {
        if (!modelFile.blob) {  
          failCount++
          continue
        }
        const fileToUpload = new File([modelFile.blob], modelFile.name, {
          type: modelFile.type === 'glb' ? 'model/gltf-binary' : 'model/gltf+json'
        })
        
        if (!validateFile(fileToUpload)) {
          failCount++
          continue
        }
        
        const formData = new FormData()
        // 后端期望接收多个 files 字段
        formData.append('files', fileToUpload)
        formData.append('productName', modelFile.productName || modelFile.name.replace(/\.(glb|gltf)$/i, ''))
        formData.append('category', modelFile.category || '')
        formData.append('description', modelFile.description || '')
        // ifDraco: 指示后端是否对该文件进行 Draco 压缩
        formData.append('ifDraco', modelFile.ifDraco ? 'true' : 'false')
        // 如果需要，可以传 compressionLevel（这里默认不设置，除非未来加入输入）
        if (modelFile.surfacePlot) {
          formData.append('surface_plot', modelFile.surfacePlot)
        }
        if (user) {
          formData.append('user', user)
        }
        
        await uploadAndProcessFile(formData)
        successCount++
      } catch (error) {
        console.error(`文件 "${modelFile.name}" 上传失败:`, error)
        failCount++
      }
    }
    
    if (failCount === 0) {
      ElMessage.success(`成功上传 ${successCount} 个文件！`)
    } else if (successCount > 0) {
      ElMessage.warning(`上传完成：成功 ${successCount} 个，失败 ${failCount} 个`)
    } else {
      ElMessage.error('所有文件上传失败')
    }
    
    closeZipPreviewModal()
    closeUploadModal()
    emit('uploadSuccess')
  } catch (error) {
    console.error('批量上传失败:', error)
    ElMessage.error(error.message || '上传失败')
  } finally {
    isUploading.value = false
  }
}

const handleFileUpload = async (event) => {
  const target = event.target
  const file = target.files?.[0]
  
  if (!file) return
  
  if (!validateFile(file)) return
  
  uploadedFile.value = file
  
  if (file.name.toLowerCase().endsWith('.zip')) {
    await handleZipFile(file)
  } else {
    ElMessage.success(`已选择文件: ${file.name}`)
  }
}

const handleZipFile = async (zipFile) => {
  try {
    ElMessage.info('正在解析压缩包内容...')
    const parseResult = await parseZipFile(zipFile)
    
    if (!parseResult.success) {
      ElMessage.error(`解析失败: ${parseResult.error}`)
      return
    }
    
    if (parseResult.modelFileCount === 0) {
      ElMessage.warning('压缩包中未找到GLB或GLTF格式的3D模型文件')
      return
    }
    
    zipParseResult.value = parseResult
    zipFileName.value = zipFile.name
    showZipPreviewModal.value = true
    
    ElMessage.success(`成功解析压缩包，发现 ${parseResult.modelFileCount} 个3D模型文件`)
  } catch (error) {
    console.error('ZIP文件处理失败:', error)
    ElMessage.error(`处理ZIP文件失败: ${error.message || '未知错误'}`)
  }
}

const validateFile = (file) => {
  const allowedTypes = ['.glb', '.gltf', '.zip']
  const fileExtension = file.name.toLowerCase().substring(file.name.lastIndexOf('.'))
  
  if (!allowedTypes.includes(fileExtension)) {
    ElMessage.error('请上传 GLB、GLTF 或 ZIP 格式的文件')
    return false
  }
  
  const maxSize = fileExtension === '.zip' ? 500 * 1024 * 1024 : 100 * 1024 * 1024
  if (file.size > maxSize) {
    const maxSizeMB = Math.round(maxSize / (1024 * 1024))
    ElMessage.error(`${fileExtension.toUpperCase()}文件大小不能超过${maxSizeMB}MB`)
    return false
  }
  
  return true
}

const startUpload = async () => {
  if (!uploadedFile.value && !isEditMode.value) {
    ElMessage.error('请先选择文件')
    return
  }
  
  if (!uploadForm.value.productName.trim()) {
    ElMessage.error('请输入产品名称')
    return
  }
  
  if (!uploadForm.value.category) {
    ElMessage.error('请选择产品分类')
    return
  }
  
  isUploading.value = true
  
  try {
    if (isEditMode.value) {
      // 编辑模式
      ElMessage.info('正在保存修改...')
      
      if (!props.editModel) {
        ElMessage.error('编辑数据异常')
        return
      }
      
      const fileInfo = {
        id: AESencrypt.encryptsixteen(props.editModel.id.toString()),
        fileUrl: props.editModel.fileUrl, // 不加密fileUrl
        productName: uploadForm.value.productName,
        category: uploadForm.value.category,
        description: uploadForm.value.description,
        user: props.editModel.uploadUser
        // 注意：编辑模式下不包含封面图片和文件信息
      }
      
      await alterModelData(fileInfo)
      
      ElMessage.success('修改保存成功！')
      emit('editSuccess')
    } else {
      // 上传模式
      ElMessage.info('开始上传文件...')
      
      const formData = new FormData()
      formData.append('file', uploadedFile.value)
      formData.append('productName', uploadForm.value.productName)
      formData.append('category', uploadForm.value.category)
      formData.append('description', uploadForm.value.description)
      // 指示后端是否进行 Draco 压缩
      formData.append('ifDraco', uploadForm.value.ifDraco ? 'true' : 'false')
      // 如果未来需要压缩级别，可加入 compressionLevel 字段（int 0-10）
      if (uploadForm.value.compressionLevel !== undefined && uploadForm.value.compressionLevel !== null) {
        formData.append('compressionLevel', String(uploadForm.value.compressionLevel))
      }
      if (uploadForm.value.surfacePlot) {
        formData.append('surface_plot', uploadForm.value.surfacePlot)
      }
      
      const userInfo = getUserInfo()
      if (userInfo?.user) {
        formData.append('user', userInfo.user)
      }
      
      await uploadAndProcessFile(formData)
      
      ElMessage.success('上传完成！')
      emit('uploadSuccess')
    }
    
    closeUploadModal()
  } catch (error) {
    console.error(isEditMode.value ? '修改失败:' : '上传失败:', error)
    ElMessage.error((isEditMode.value ? '修改失败: ' : '上传失败: ') + (error.message || '未知错误'))
  } finally {
    isUploading.value = false
  }
}
</script>

<style scoped>
/* 上传模态框样式 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.upload-modal {
  background: white;
  border-radius: 15px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  color: #333;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
  padding: 0;
  line-height: 1;
}

.close-btn:hover {
  background: #f5f5f5;
  color: #333;
  transform: scale(1.1);
}

.modal-body {
  padding: 25px;
}

.product-form {
  margin-bottom: 25px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  background: white;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: #3742fa;
  box-shadow: 0 0 0 2px rgba(55, 66, 250, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.cover-upload {
  margin-top: 8px;
}

.cover-zone {
  display: block;
  width: 100px;
  height: 100px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  overflow: hidden;
  background: #fafafa;
}

.cover-zone:hover {
  border-color: #3742fa;
  background: #f8f9ff;
}

.cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  color: #999;
}

.upload-icon {
  width: 32px;
  height: 32px;
  opacity: 0.5;
}

.cover-placeholder p {
  margin: 0;
  font-size: 14px;
}

.cover-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-area {
  margin-bottom: 20px;
}

.upload-zone {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 25px 15px;
  text-align: center;
  cursor: pointer;
}

.upload-zone:hover {
  border-color: #3742fa;
  background: #f8f9ff;
}

.upload-zone.has-file {
  border-color: #2ed573;
  background: #f0fff4;
}

.upload-label {
  display: block;
  cursor: pointer;
}

.upload-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.upload-primary {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin: 0;
}

.upload-secondary {
  font-size: 12px;
  color: #666;
  margin: 0;
}

.modal-footer {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  padding: 20px 25px;
  border-top: 1px solid #eee;
  background: #f8f9fa;
}

.btn-primary {
  background: #3742fa;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: #2f3af2;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(55, 66, 250, 0.3);
}

.btn-primary:disabled {
  background: #999;
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-cancel {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-cancel:hover:not(:disabled) {
  background: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.btn-cancel:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* 上传中状态样式 */
.uploading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 编辑模式样式 */
.current-file-info {
  margin-bottom: 20px;
}

.current-file-card {
  display: flex;
  align-items: center;
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-bottom: 15px;
}

.file-icon {
  font-size: 24px;
  margin-right: 12px;
}

.file-details {
  flex: 1;
}

.file-name {
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
}

.file-url {
  font-size: 12px;
  color: #666;
  word-break: break-all;
}

.file-divider {
  text-align: center;
  margin: 15px 0;
  position: relative;
}

.file-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #ddd;
}

.file-divider span {
  background: white;
  padding: 0 15px;
  color: #666;
  font-size: 12px;
}

.file-info-note {
  text-align: center;
  margin-top: 10px;
  padding: 8px 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.file-info-note span {
  color: #666;
  font-size: 12px;
  font-style: italic;
}

.file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-download {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #3742fa;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s;
}

.btn-download:hover {
  background: #2f3af2;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(55, 66, 250, 0.3);
}

.action-icon {
  width: 14px;
  height: 14px;
  opacity: 0.9;
}

/* 封面只读区域 */
.cover-readonly-section {
  margin-top: 8px;
}

.current-cover.readonly {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #d0d0d0;
  opacity: 0.8;
}

.cover-overlay.readonly {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.current-cover.readonly:hover .cover-overlay.readonly {
  opacity: 1;
}

.readonly-text {
  color: white;
  font-size: 10px;
  text-align: center;
  padding: 0 8px;
}

.no-cover {
  width: 100px;
  height: 100px;
  border: 2px dashed #d0d0d0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8f8f8;
  opacity: 0.8;
}

.no-cover-icon {
  font-size: 24px;
  margin-bottom: 4px;
  opacity: 0.5;
}

.no-cover-text {
  font-size: 12px;
  color: #666;
  margin: 0 0 2px 0;
}

.no-cover-note {
  font-size: 10px;
  color: #999;
  margin: 0;
  text-align: center;
}
</style>

